id/email
password
forgot password | create account
about | help | prefs
ReadingBatcode reading practice

 

 

Lambda IntroNoArgLambda4

// Higher-order function as a return type fun funcGen1(i: Int): () -> Int { return { i } } fun funcNoArg4a(i: Int, j: Int): Int = i * funcGen1(j).invoke() fun funcNoArg4b(i: Int, j: Int): Int = i * funcGen1(j)() fun main() { println(funcNoArg4a(5, 10)) println(funcNoArg4a(10, 15)) println(funcNoArg4b(6, 12)) println(funcNoArg4b(20, 25)) }

Click on to run the code

⬅ Back